<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
	<link rel="stylesheet" href="${ctx}/js/lib/ztree/zTreeStyle/zTreeStyle.css" type="text/css">
	<script type="text/javascript" src="${ctx}/js/lib/ztree/jquery.ztree.all-3.5.js"></script>
	<link type="text/css" rel="stylesheet" href="${ctx}/css/dlifestyle/org.css" />
	<script type="text/javascript">
	function setCtx(ctx){
		this.ctx = ctx;
	}
	</script>
	
			<section class="scrollable padder">
              <div style="height:40px;line-height: 40px;">
                    <div class="forword_area"></div>
					<div class="location">当前位置：${sessionScope.currcent_position}</div>

              </div>
              <hr>
		              <section>
		              	
					    <!--begin 搜索栏 -->
			                  <div class="panel" >
				                  <div style="float:left;height: 28px;">
				                  
						            <input id="search_condition" style="width:170px;" type="text" placeholder="名称" class="input-sm" />
								    </div>
						             <div class="form-control">
						            	 <div class="search" onclick="search_ztree('treeDemo', 'search_condition')"><img src="${ctx }/images/table/search_second.png"></div>
						            	<%--  <div class="search" onclick="addMenuClick();"><img src="${ctx }/images/table/add_second.png"></div> --%>
									<a class="rolebtn-group" style="color:white;background:#28C7C9;height:28px;display: block;width:103px;margin-left: 100px;border-radius:4px;" onclick="saveOrUpdateMenu();">
									<span style="height:25px;vertical-align:center;line-height:25px;"><img style="margin-top:-3px;" src="${ctx}/images/table/rolemenu.png" /></span>新增菜单</a> 
						
									<a class="rolebtn-group" style="color:white;background:#28C7C9;height:28px;display: block;width:103px;margin-left: 225px;margin-top: -28px;border-radius:4px;" onclick="saveOrUpdateButton();">
									<span style="height:25px;vertical-align:center;line-height:25px;"><img style="margin-top:-3px;" src="${ctx}/images/table/rolemenu.png"/></span>新增按钮</a>
						             	 <input type="hidden" id="callbackTrigger" />
						             </div>
					           </div>
			                <!--end 搜索栏 -->
		              	
		              		<!--生成树  -->
							<div class="content_wrap" style="width:210px;float:left;margin-top: 20px;">
								<div class="modal-header">
									<ul style="height: 40px;line-height: 40px;margin-left: 20px;">
									<li style="display:inline;list-style:none;float: left;">
										<img src="${ctx }/images/system/org_title.png">
									</li>
									<li style="display:inline;width: 150px;height: 40px;">
											<select class="dropdown-menu-selectCell" id="cells" onchange="onLoadZTree(this.value);"
											 style="height: 19px;padding: 0px 0px;float: none;background-color: #FFFFFF;width: 120px;border: none;font-size: 13px;font-family: '微软雅黑';">
			    				  				<option value="1" selected="selected">运营/物业</option>
			                      				<option value="2">商户端</option>
			                      				<option value="3">业主端</option>
			                      				<option value="4">配送端</option>
		                       				</select>
									</li>
									</ul>
								</div>
								<div class="zTreeDemoBackground left">
									<ul id="treeDemo" class="ztree"></ul>
								</div>
							</div>
							
							<!--菜单详情  -->
							 <input type="hidden" id="menubuttontype" />
							<div id="orgDetail" class="right" style=" margin-left: 280px;  margin-top: 20px;height: 150px;">
									<div class="modal-header">
										<h4 class="modal-title" id="detailmenu">菜单详情</h4>
										<input type="hidden" id="menuId"/>
										<input type="hidden" id="states"/>
									<!-- begin table表格 -->
							<table id="tb1" style="width:100%; margin-top:0px;table-layout:fixed" class="table table-striped b-t b-light">
									<tr>
										<td width="6%" style="background-color: #e0eff3;height:40px">类型</td>
										<td width="10%" style="background-color: #e0eff3;height:40px">菜单名称 </td>
										<td width="9%" style="background-color: #e0eff3;height:40px">菜单级别</td>
										<td width="15%" style="background-color: #e0eff3;height:40px">本地路径</td>
										<td width="6%" style="background-color: #e0eff3;height:40px">菜单状态</td>
										<td width="6%" style="background-color: #e0eff3;height:40px">顺序</td>
										<td width="10%" style="background-color: #e0eff3;height:40px">操作</td>
									</tr>
									<tr>
										<td><span id="mtype"></span></td>
										<td><span id="mname"></span></td>
										<td><span id="menuLevel"></span></td>
										<td><span id="locationURL"></span></td>
										<td><span id="menuState"></span></td>
										<td><span id="menuOrder"></span></td>
										<td>
											 <a class="fa fa-check " onclick="saveOrUpdateMenu($('#menuId').val(),$('#states').val());">编辑&nbsp;&nbsp;|&nbsp;</a>
	                          				<a id="menuStatement" class="fa fa-check "></a>
			                          	</td>
									</tr>
								</table> 
								<table id="tb2" style="width:100%; margin-top:0px;table-layout:fixed" class="table table-striped b-t b-light">
									<tr>
										<td width="6%" style="background-color: #e0eff3;height:40px">类型</td>
										<td width="10%" style="background-color: #e0eff3;height:40px">按钮名称 </td>
										<td width="10%" style="background-color: #e0eff3;height:40px">按钮值 </td>
										<td width="6%" style="background-color: #e0eff3;height:40px">按钮状态</td>
										<td width="10%" style="background-color: #e0eff3;height:40px">操作</td>
									</tr>
									<tr>
										<td><span id="btype"></span></td>
										<td><span id="bname"></span></td>
										<td><span id="bvalue"></span></td>
										<td><span id="buttonState"></span></td>
										<td>
											 <a class="fa fa-check " onclick="saveOrUpdateButton($('#menuId').val());">编辑&nbsp;&nbsp;|</a>
											 <a id="buttonStatement" class="fa fa-check "></a>
			                          	</td>
									</tr>
								</table> 
									</div>
								
							</div>
		            </section>
			</section>
		<input type="hidden" id="parentId"/>
	<%@include file="/views/common/footer.jsp"%>
  	<script type="text/javascript">
		var ctx = '${ctx}';
		
		/* document.getElementById("myFrom").reset(); */
		

		var curMenu = null, zTree_Menu = null;
		var setting = {
			view: {
				showLine: true,
				showIcon: true,
				selectedMulti: false,
				dblClickExpand: false,
				addDiyDom: addDiyDom,
				fontCss: setFontCss_ztree,
			},
			edit: {
				enable: true,
				showRemoveBtn: false,
				showRenameBtn: false
				},
			data: {
				keep: {
					parent:true,
					leaf:true
				},
				simpleData: {
					enable: true,
					idKey: "id",
					pIdKey: "pId",
					rootPid: null 
				},
			},
			callback: {
				/* beforeClick: beforeClick, */
				onClick : onClick,
				onAsyncSuccess: zTreeOnAsyncSuccess,
				beforeDrag: beforeDrag,
				beforeExpand: beforeExpand,
				onExpand: onExpand
			}
		};

  		var zNodes;
  		
  		function onClick(event, treeId, treeNode, clickFlag) {  
  			
			var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
			nodes = zTree.getSelectedNodes(),
			treeNode = nodes[0];
			
			loading(treeNode);

  		}
  		
  		function loading(treeNode){
 		   $.ajax({
			    async:true,//是否异步
			    cache:false,//是否使用缓存
			    type:'get',//请求方式：post
			    dataType:'json',//数据传输格式：json
			    url:ctx + "/menubutton/menuButtonDetail?id=" + treeNode.id ,//请求的action路径
			    error:function(){
			      //请求失败处理函数
			    	layer.msg('请求失败!', {icon: 5});
			    },
			    success:function(data){
			    	$("#menuId").val(data.id);
			    	$("#states").val(data.state);
			    	$("#locationURL").text(data.locationURL);
			    	$("#menuOrder").text(data.menuOrder);
			    	$("#location").text(data.location);
			    	$("#name").text(data.menuName);
		    		$("#bvalue").text(data.value);
			    	var menubuttontype = $("#menubuttontype").val(data.type);
			    	if($("#menubuttontype").val() == 1){
			    		$("#tb1").show();
			    		$("#tb2").hide();
			    		};
			    	if($("#menubuttontype").val() == 2){
			    		$("#tb1").hide();
			    		$("#tb2").show();
			    		};
			    	if(1 == data.type){
			    		if(data.system == 1){
			    			if(data.menuType == 1){
				    			$("#mtype").text("平台菜单");
				    		}else{
				    			$("#mtype").text("小区菜单");
				    		}
			    		}else{
			    			$("#mtype").text("菜单");
			    		}
			    		
			    		
			    		$("#mname").text(data.menuName);
			    		$("#detailmenu").text("菜单详情");	
			    	}else if(2 == data.type){
			    		$("#btype").text("按钮");
			    		$("#bname").text(data.menuName);
			    		$("#detailmenu").text("按钮详情");	
			    	}
			    	if(1 == data.menuLevel){
			    		$("#menuLevel").text("一级菜单");
			    	} if(2 == data.menuLevel){
			    		$("#menuLevel").text("二级菜单");
			    	}if(3 == data.menuLevel){
			    		$("#menuLevel").text("三级菜单");
			    	}else if(4 == data.menuLevel){
			    		$("#menuLevel").text("四级菜单");
			    	}
			    	if(1 == data.state){
			    		if(1 == data.type){
			    		$("#menuState").text("正常");
			    		$("#menuStatement").html("禁用");
			    		$("#menuStatement").click(function(){
			    			toggleMenuState(data.id,data.state);
			    		})
				    	}else if(2 == data.type){
				    		$("#buttonState").text("正常");
				    		$("#buttonStatement").html("禁用");
				    		$("#buttonStatement").click(function(){
				    			toggleButtonState(data.id,data.state);
				    		})	
				    	}
			    	}else if(0 == data.state){
			    		if(1 == data.type){
				    		$("#menuState").text("禁用");
				    		$("#menuStatement").html("启用");
				    		$("#menuStatement").click(function(){
				    			toggleMenuState(data.id,data.state);
				    		})
					    	}else if(2 == data.type){
					    		$("#buttonState").text("禁用");
					    		$("#buttonStatement").html("启用");
					    		$("#buttonStatement").click(function(){
					    			toggleButtonState(data.id,data.state);
					    		})	
					    	}
			    	}
   		   }
  			});
  		}
  		
  	//停用，启用菜单方法
  		function toggleMenuState(menuId,state){
  			//确认框

  			var mess = "";
  			if(state == 1){
  				mess ="请确认将要停用该菜单及其子菜单!"; 
  				state = 0;
  			}else{
  				mess ="请确认将要启用该菜单!"; 
  				state = 1;
  			}
  			
  			//icon: 1表示正确 2 删除 3 提示
  			 layer.confirm(mess, {icon: 3,title:'提示'}, function(index){
  				    //do something
  					$.get(ctx + "/menubutton/updateMenuStateById",{
  						menuId: menuId,
  						state: state
  					},function(data){
  						data = JSON.parse(data);
  						if(data.success){
  							layer.msg("操作成功",{
  							    icon: 1,
  							    time: 1000 //2秒关闭（如果不配置，默认是3秒）
  							},function(){
  								//loadContent("/menubutton/menuButtonList");
  								 if(state == 1){ 
  								$("#menuStatement").html("禁用");
  								$("#menuState").text("正常");
  								$("#menuStatement").click(function(){
  									toggleMenuState(menuId,state);
  					    		})
  								}else if(state == 0){
  									$("#menuStatement").html("启用");
  									$("#menuState").text("禁用");
  									$("#menuStatement").click(function(){
  										toggleMenuState(menuId,state);
  	  					    		})
  								} 
   								$("#states").val(state);
  							}
  							);
  						}else{
  							layer.msg("操作失败",{
  							    icon: 2,
  							    time: 1000 //2秒关闭（如果不配置，默认是3秒）
  							});
  						}
  					});
  				    layer.close(index);
  				}); 
  			
  		}  	
  	
  	//停用，启用按钮方法
  		function toggleButtonState(menuId,state){
  			//确认框

  			var mess = "";
  			if(state == 1){
  				mess ="请确认将要停用该按钮!"; 
  				state = 0;
  			}else{
  				mess ="请确认将要启用该按钮!"; 
  				state = 1;
  			}
  			
  			//icon: 1表示正确 2 删除 3 提示
  			 layer.confirm(mess, {icon: 3,title:'提示'}, function(index){
  				    //do something
  					$.get(ctx + "/menubutton/updateMenuStateById",{
  						menuId: menuId,
  						state: state
  					},function(data){
  						data = JSON.parse(data);
  						if(data.success){
  							layer.msg("操作成功",{
  							    icon: 1,
  							    time: 1000 //2秒关闭（如果不配置，默认是3秒）
  							},function(){
  								//loadContent("/menubutton/menuButtonList");
  								 if(state == 1){ 
  								$("#buttonStatement").html("禁用");
  								$("#buttonState").text("正常");
  								$("#buttonStatement").click(function(){
  					    			toggleButtonState(menuId,state);
  					    		})
  								}else if(state == 0){
  									$("#buttonStatement").html("启用");
  									$("#buttonState").text("禁用");
  									$("#buttonStatement").click(function(){
  										toggleButtonState(menuId,state);
  	  					    		})
  								} 
   								$("#states").val(state);
  							}
  							);
  						}else{
  							layer.msg("操作失败",{
  							    icon: 2,
  							    time: 1000 //2秒关闭（如果不配置，默认是3秒）
  							});
  						}
  					});
  				    layer.close(index);
  				}); 
  			
  		}  	
  	
 		function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
 			zNodes = JSON.parse(msg);
 			layer.msg(msg, {icon: 5});
 		};
 			
		function addDiyDom(treeId, treeNode) {
			var spaceWidth = 5;
			var switchObj = $("#" + treeNode.tId + "_switch"),
			icoObj = $("#" + treeNode.tId + "_ico");
			switchObj.remove();
			icoObj.before(switchObj);

			if (treeNode.level > 1) {
				var spaceStr = "<span style='display: inline-block;width:" + (spaceWidth * treeNode.level)+ "px'></span>";
				switchObj.before(spaceStr);
			}
		}

		
		var treeNodes;
		 
		function onLoadZTree(system){
			$("#orgDetail").hide();
    		
			   $.ajax({
			    async:true,//是否异步
			    cache:false,//是否使用缓存
			    type:'post',//请求方式：post
			    dataType:'json',//数据传输格式：json
			    url:ctx + "/menubutton/treeData?system=" + system,//请求的action路径
			    error:function(){
			      //请求失败处理函数
			      layer.msg('请求失败!', {icon: 5});
			    },
			    success:function(data){
			    	if(!data.success){
			    		layer.msg(data.msg, {icon: 5});
			    		return;
			    	}
			      	var t = $("#treeDemo");
					 $.fn.zTree.init(t, setting, eval(data.obj));
					 //初始化树时默认选择第一个节点
						zTree_Menu = $.fn.zTree.getZTreeObj("treeDemo");
						curMenu = zTree_Menu.getNodes();
						
					      if (curMenu.length>0) 
					      {
					            zTree_Menu.selectNode(curMenu[0]);
					            
					            loading(curMenu[0]);
					            $("#orgDetail").show();
					      }
			    }
			  });
			  
			  
			}
		
		$(document).ready(function(){
			
			onLoadZTree(1);
			
			/* $("#orgLevel").hide(); */
		});
			
		
		//==========================搜索树begin===================================//
		
		/**
     * 展开树
     * @param treeId  
     */
    function expand_ztree(treeId){
        var treeObj = $.fn.zTree.getZTreeObj(treeId);
        treeObj.expandAll(true);
    }
     
    /**
     * 收起树：只展开根节点下的一级节点
     * @param treeId
     */
    function close_ztree(treeId){
        var treeObj = $.fn.zTree.getZTreeObj(treeId);
        var nodes = treeObj.transformToArray(treeObj.getNodes());
        var nodeLength = nodes.length;
        for (var i = 0; i < nodeLength; i++) {
            if (nodes[i].id == '0') {
                //根节点：展开
                treeObj.expandNode(nodes[i], true, true, false);
            } else {
                //非根节点：收起
                treeObj.expandNode(nodes[i], false, true, false);
            }
        }
    }
     
    /**
     * 搜索树，高亮显示并展示【模糊匹配搜索条件的节点s】
     * @param treeId
     * @param searchConditionId 文本框的id
     */
    function search_ztree(treeId, searchConditionId){
        searchByFlag_ztree(treeId, searchConditionId, "");
    }
     
    /**
     * 搜索树，高亮显示并展示【模糊匹配搜索条件的节点s】
     * @param treeId
     * @param searchConditionId     搜索条件Id
     * @param flag                  需要高亮显示的节点标识
     */
    function searchByFlag_ztree(treeId, searchConditionId, flag){
        //<1>.搜索条件
        var searchCondition = $('#' + searchConditionId).val();
        //<2>.得到模糊匹配搜索条件的节点数组集合
        var highlightNodes = new Array();
        if (searchCondition != "") {
            var treeObj = $.fn.zTree.getZTreeObj(treeId);
            highlightNodes = treeObj.getNodesByParamFuzzy("name", searchCondition, null);
        }
        //<3>.高亮显示并展示【指定节点s】
        highlightAndExpand_ztree(treeId, highlightNodes, flag);
    }
     
    /**
     * 高亮显示并展示【指定节点s】
     * @param treeId
     * @param highlightNodes 需要高亮显示的节点数组
     * @param flag           需要高亮显示的节点标识
     */
    function highlightAndExpand_ztree(treeId, highlightNodes, flag){
        var treeObj = $.fn.zTree.getZTreeObj(treeId);
        //<1>. 先把全部节点更新为普通样式
        var treeNodes = treeObj.transformToArray(treeObj.getNodes());
        for (var i = 0; i < treeNodes.length; i++) {
            treeNodes[i].highlight = false;
            treeObj.updateNode(treeNodes[i]);
        }
        //<2>.收起树, 只展开根节点下的一级节点
        close_ztree(treeId);
        //<3>.把指定节点的样式更新为高亮显示，并展开
        if (highlightNodes != null) {
            for (var i = 0; i < highlightNodes.length; i++) {
                if (flag != null && flag != "") {
                    if (highlightNodes[i].flag == flag) {
                        //高亮显示节点，并展开
                        highlightNodes[i].highlight = true;
                        treeObj.updateNode(highlightNodes[i]);
                        //高亮显示节点的父节点的父节点....直到根节点，并展示
                        var parentNode = highlightNodes[i].getParentNode();
                        var parentNodes = getParentNodes_ztree(treeId, parentNode);
                        treeObj.expandNode(parentNodes, true, true, false);
                        treeObj.expandNode(parentNode, true, true, false);
                    }
                } else {
                    //高亮显示节点，并展开
                    highlightNodes[i].highlight = true;
                    treeObj.updateNode(highlightNodes[i]);
                    //高亮显示节点的父节点的父节点....直到根节点，并展示
                    var parentNode = highlightNodes[i].getParentNode();
                    var parentNodes = getParentNodes_ztree(treeId, parentNode);
                    treeObj.expandNode(parentNodes, true, true, false);
                    treeObj.expandNode(parentNode, true, true, false);
                }
            }
        }
    }
     
    /**
     * 递归得到指定节点的父节点的父节点....直到根节点
     */
    function getParentNodes_ztree(treeId, node){
        if (node != null) {
            var treeObj = $.fn.zTree.getZTreeObj(treeId);
            var parentNode = node.getParentNode();
            return getParentNodes_ztree(treeId, parentNode);
        } else {
            return node;
        }
    }
     
    /**
     * 设置树节点字体样式
     */
     function setFontCss_ztree(treeId, treeNode) {
    	
        /* if(treeNode.type == 2){//如果是按钮
            return { "background-color":"#ffcd6d","padding-left":"15px","border-radius":"5px"
        	};
        } */

     }
 
     /*保持单一展开路径  */
		var curExpandNode = null;
		function beforeExpand(treeId, treeNode) {
			var pNode = curExpandNode ? curExpandNode.getParentNode():null;
			var treeNodeP = treeNode.parentTId ? treeNode.getParentNode():null;
			var zTree = $.fn.zTree.getZTreeObj("treeDemo");
			for(var i=0, l=!treeNodeP ? 0:treeNodeP.children.length; i<l; i++ ) {
				if (treeNode !== treeNodeP.children[i]) {
					zTree.expandNode(treeNodeP.children[i], false);
				}
			}
			while (pNode) {
				if (pNode === treeNode) {
					break;
				}
				pNode = pNode.getParentNode();
			}
			if (!pNode) {
				singlePath(treeNode);
			}

		}
		function singlePath(newNode) {
			if (newNode === curExpandNode) return;

         var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
                 rootNodes, tmpRoot, tmpTId, i, j, n;

         if (!curExpandNode) {
             tmpRoot = newNode;
             while (tmpRoot) {
                 tmpTId = tmpRoot.tId;
                 tmpRoot = tmpRoot.getParentNode();
             }
             rootNodes = zTree.getNodes();
             for (i=0, j=rootNodes.length; i<j; i++) {
                 n = rootNodes[i];
                 if (n.tId != tmpTId) {
                     zTree.expandNode(n, false);
                 }
             }
         } else if (curExpandNode && curExpandNode.open) {
				if (newNode.parentTId === curExpandNode.parentTId) {
					zTree.expandNode(curExpandNode, false);
				} else {
					var newParents = [];
					while (newNode) {
						newNode = newNode.getParentNode();
						if (newNode === curExpandNode) {
							newParents = null;
							break;
						} else if (newNode) {
							newParents.push(newNode);
						}
					}
					if (newParents!=null) {
						var oldNode = curExpandNode;
						var oldParents = [];
						while (oldNode) {
							oldNode = oldNode.getParentNode();
							if (oldNode) {
								oldParents.push(oldNode);
							}
						}
						if (newParents.length>0) {
							zTree.expandNode(oldParents[Math.abs(oldParents.length-newParents.length)-1], false);
						} else {
							zTree.expandNode(oldParents[oldParents.length-1], false);
						}
					}
				}
			}
			curExpandNode = newNode;
		}

		function onExpand(event, treeId, treeNode) {
			curExpandNode = treeNode;
		}
		
		//==========================搜索树end===================================//
		
		//==========================删除树begin===================================//
		
		function beforeDrag(treeId, treeNodes) {
			return false;
		}

		//弹出菜单新增或编辑框
		function saveOrUpdateMenu (id,state) {
			if(id != null){
				var msg;
				var url;
				if(state == 1){
					msg = "编辑菜单";
					url =  ctx + "/menubutton/selectPK?id="+id+"";
					saveOrUpdateBox(msg,url);
				}else{
					layer.msg("当前菜单处于停用状态，不能编辑！",{
					    icon: 3,
					    time: 1000 //2秒关闭（如果不配置，默认是3秒）
					});
				}
			}else{
				
				$("#parentMenu").attr("style","display:none");
				msg = "新增菜单";
				url = ctx + "/menubutton/selectPK?id=0";
				saveOrUpdateBox(msg,url);
				
			}
		}
		var index;
		function saveOrUpdateBox(msg,url){
		    //官网欢迎页
			index = layer.open({
		        type: 2,
		        //skin: 'layui-layer-lan',
		        title: msg,
		        fix: false,
		        shadeClose: true,
		        scrollbar: false,
		        maxmin: false,
		        edit: true,
		        closeBtn: 1,
		        area: ['500px', '399px'],
		        content: url,
		        btn: ['确定', '取消']
			    ,yes: function(index, layero){ //或者使用btn1
			        //按钮【按钮一】的回调

			    	var iframeWin = window[layero.find('iframe')[0]['name']]; 
			    	iframeWin.saveOrUpdateMenu();

			    },cancel: function(index){ //或者使用btn2
			        //按钮【按钮二】的回调
			    }
			    });
		}
		
		//新增或编辑用户(1:新增 2:编辑)
		function saveOrUpdateButton (btnId) {
			if(btnId != null){
				msg = "编辑按钮";
				url =  ctx + "/menubutton/buttonBox?id="+btnId+"";
				saveOrUpdateButtonBox(msg,url);
				
			}else{
				msg = "新增按钮";
				url =  ctx + "/menubutton/buttonBox?id=0";
				saveOrUpdateButtonBox(msg,url);
			}
			
		}

		var index;
		function saveOrUpdateButtonBox(msg,url){
		    //官网欢迎页
			index = layer.open({
		        type: 2,
		        //skin: 'layui-layer-lan',
		        title: msg,
		        fix: false,
		        shadeClose: true,
		        scrollbar: false,
		        maxmin: false,
		        edit: true,
		        closeBtn: 1,
		        area: ['500px', '290px'],
		        content: url,
		        btn: ['确定', '取消']
			    ,yes: function(index, layero){ //或者使用btn1
			        //按钮【按钮一】的回调

			    	var iframeWin = window[layero.find('iframe')[0]['name']]; 
			    	iframeWin.saveOrUpdateBtn();

			    },cancel: function(index){ //或者使用btn2
			        //按钮【按钮二】的回调
			    }
			    });
		}


	</script>  
	<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
	<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
